/*

=============================================================================

Copyright (c) 2010 Xiotex Studios Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by Xiotex Studios Ltd (http://xiotexstudios.com)", in the same
place and form as other third-party acknowledgments. Alternately, this
acknowledgment may appear in the software itself, in the same form and
location as other such third-party acknowledgments.

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 

=============================================================================

File:		SWFMath.h
Author:		(Ola)Dotun Rominiyi

Update(s):	

=============================================================================

*/

#ifndef __SWFMATH_H__
#define __SWFMATH_H__

#define gPi						3.14159265

#define f32Max					10e+37f
#define f32Min					10e-37f
#define f32Epsilon				10e-05f

#define s32Max					2147483647
#define s32MinValue				-2147483647
#define u32MaxValue				4294967295

#ifdef WIN32 

#include <math.h>

inline	float32 swfAbsf(float32 _x)					{ return fabs(_x); }
inline	float64	swfAbsf(float64 _x)					{ return fabs(_x); }

inline	float32 swfSinf(float32 _x)					{ return sin(_x); }
inline	float64 swfSinf(float64 _x)					{ return sin(_x); }

inline	float32 swfCosf(float32 _x)					{ return cos(_x); }
inline	float64 swfCosf(float64 _x)					{ return cos(_x); }

inline	float32 swfTanf(float32 _x)					{ return tan(_x); }
inline	float64 swfTanf(float64 _x)					{ return tan(_x); }

inline	float32 swfArcSinf(float32 _x)				{ return asin(_x); }
inline	float64 swfArcSinf(float64 _x)				{ return asin(_x); }

inline	float32 swfArcCosf(float32 _x)				{ return acos(_x); }
inline	float64 swfArcCosf(float64 _x)				{ return acos(_x); }

inline	float32 swfArcTanf(float32 _x)				{ return atan(_x); }
inline	float64 swfArcTanf(float64 _x)				{ return atan(_x); }

inline	float32 swfArcTan2f(float32 _x, float32 _y)	{ return atan2(_x,_y); }
inline	float64 swfArcTan2f(float64 _x, float64 _y)	{ return atan2(_x,_y); }

inline	float32 swfLogf(float32 _x)					{ return logf(_x); }
inline	float64 swfLogf(float64 _x)					{ return log(_x); }

inline	float32 swfSqrtf(float32 _x)				{ return sqrtf(_x); }
inline	float64 swfSqrtf(float64 _x)				{ return sqrt(_x); }

inline	float32 swfPowf(float32 _x, float32 _y)		{ return powf(_x,_y); }
inline	float64 swfPowf(float64 _x, float64 _y)		{ return pow(_x,_y); }

inline	float32 swfFloorf(float32 _x)				{ return floorf(_x); }
inline	float64 swfFloorf(float64 _x)				{ return floor(_x); }

inline	float32 swfCeilf(float32 _x)				{ return ceilf(_x); }
inline	float64 swfCeilf(float64 _x)				{ return ceil(_x); }

#elif IPHONE

#include <math.h>

inline	float32 swfAbsf(float32 _x)					{ return fabsf(_x); }
inline	float64	swfAbsf(float64 _x)					{ return fabsf(_x); }

inline	float32 swfSinf(float32 _x)					{ return sinf(_x); }
inline	float64 swfSinf(float64 _x)					{ return sinf(_x); }

inline	float32 swfCosf(float32 _x)					{ return cosf(_x); }
inline	float64 swfCosf(float64 _x)					{ return cosf(_x); }

inline	float32 swfTanf(float32 _x)					{ return tanf(_x); }
inline	float64 swfTanf(float64 _x)					{ return tanf(_x); }

inline	float32 swfArcSinf(float32 _x)				{ return asinf(_x); }
inline	float64 swfArcSinf(float64 _x)				{ return asinf(_x); }

inline	float32 swfArcCosf(float32 _x)				{ return acosf(_x); }
inline	float64 swfArcCosf(float64 _x)				{ return acosf(_x); }

inline	float32 swfArcTanf(float32 _x)				{ return atanf(_x); }
inline	float64 swfArcTanf(float64 _x)				{ return atanf(_x); }

inline	float32 swfArcTan2f(float32 _x, float32 _y)	{ return atan2f(_x,_y); }
inline	float64 swfArcTan2f(float64 _x, float64 _y)	{ return atan2f(_x,_y); }

inline	float32 swfLogf(float32 _x)					{ return logf(_x); }
inline	float64 swfLogf(float64 _x)					{ return log(_x); }

inline	float32 swfSqrtf(float32 _x)				{ return sqrtf(_x); }
inline	float64 swfSqrtf(float64 _x)				{ return sqrt(_x); }

inline	float32 swfPowf(float32 _x, float32 _y)		{ return powf(_x,_y); }
inline	float64 swfPowf(float64 _x, float64 _y)		{ return pow(_x,_y); }

inline	float32 swfFloorf(float32 _x)				{ return floorf(_x); }
inline	float64 swfFloorf(float64 _x)				{ return floorf(_x); }

inline	float32 swfCeilf(float32 _x)				{ return ceilf(_x); }
inline	float64 swfCeilf(float64 _x)				{ return ceilf(_x); }

#endif

#endif // __SWFMATH_H__


